/// <reference path="../../../../typings/index.d.ts" />
import util from '../../../common/js/util'
import NProgress from 'nprogress'
import axios from 'axios';
import address from "../../../../models/dict/address.js"  //任务字典模块
import moment from 'moment'

import task from "../../../../models/dict/task.js"  //任务字典模块
import array from "../../../../models/comm/array.js"  //数组操作模块
import yz from "../../../../models/comm/yz.js"  //数组操作模块
import Vue from 'vue'

import math from 'mathjs';




export default {
    data() {
        return {



            unitArray: task.unitArray(),

            listLoading: false,
            amount: 0,
            technologyArray: task.technologyArray(),
            imageUrl: "",
            test: {

                dddd: "11111"

            }



        }
    },
    methods: {

        getTechnologyArray() {

            return task.technologyArray();
        },
        getTechnologyName(technologyId) {
            return task.getTechnologyName(technologyId)
        },


        addDetail(technologyId) {

            var item = task.fmtDetailItem({}, this.currObj.taskClassId)
            item.technologyId = technologyId
            this.currObj.detail.push(item);


        },


        fmtTask: function () {


            task.fmtTask(this.currObj);
        },
        delDetal(row, index) {


            this.currObj.detail.splice(index, 1);
        },
       


        
        //明细中增加一行(行中行)
        addItem(item) {
            if (!item.list) {
                item.list = [];
            }

            item.list.push({
                imgUrl: "",
                part: "",
                memo: ""


            })


        }
        ,
        delItem(index, list) {
            list.splice(index, 1);

        },
        itemImgUp(res) {

            var itemIndex = parseInt(res.file.query.itemIndex)
            var index = parseInt(res.file.query.index)
            this.currObj.detail[itemIndex].list[index].imgUrl = res.file.url

            //     console.dir(res);


        },
        getAction(index, itemIndex) {



            return "/file?index=" + index + "&itemIndex=" + itemIndex



        },
        getDate(createTime) {

            return moment(createTime).format("YYYY-MM-DD HH:mm")
        }


    },
    props: {
        currObj: {

        }


    }
}